package com.heima.user.config;

import com.heima.user.interceptor.UserIdInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author Fuqiang
 * @since :2023-03-25
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    UserIdInterceptor userIdInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(userIdInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/**/login_auth");
    }
}
